#include <stdio.h>

int main_32()
{
    int N,M,ai0,aij,i,j,sum,T=0,k,P=0;
    scanf("%d%d",&N,&M);
    for (i=1;i<=N ;i++ )
    {
        scanf("%d",&ai0);
        sum=0;
        for (j=0;j<M ;j++ )
        {
            scanf("%d",&aij);
            sum+=(-aij);
        }
        T+=ai0-sum;
        if (sum>P)
        {
            P=sum;
            k=i;
        }
    }
    printf("%d %d %d",T,k,P);
	return 0;
}
